package oj;

public class LC11 {
    public int maxArea(int[] height) {
        int n=height.length;
        int left=0;
        int right=n-1;
        int max=Integer.MIN_VALUE;
        while(left<right){
            int high=Math.min(height[left],height[right]);
            int s=(right-left)*high;
            max=Math.max(max,s);
            if(height[left]<height[right]){
                left++;
            }else if(height[left]>height[right]){
                right--;
            }else{
                left++;
                right--;
            }
        }
        return max;

    }
}
